/*** 文件名：EnvironmentUtil.java** 版本信息：* 日期：2019年6月3日* Copyright 马丁洛克 Corporation 2019 版权所有   
 */
package com.sinux.generality.basesupport.utils.tool;

/****
 * @className EnvironmentUtil
 * @describe 当前环境的工具类，处理 -Dspring.profiles.active=xx 的参数问题
 * @author lhz
 * @date  2023/05/06 10:05
 * @version 0.0.1
 */

public class EnvironmentUtil {

    public static final String PROFILES = "spring.profiles.active";

    public static final String ONLINE = "online";

    public static final String PRE = "pre";

    public static final String TEST = "test";

    public static final String LOCAL = "local";

    /**
     * isTest  spring.profiles.active=test
     * @return boolean
     */
    public static boolean isTest() {
        return TEST.equalsIgnoreCase(System.getProperty(PROFILES));
    }

    /**
     * isPre  spring.profiles.active=pre
     * @return boolean
     */
    public static boolean isPre() {
        return PRE.equalsIgnoreCase(System.getProperty(PROFILES));
    }

    /**
     * isOnline spring.profiles.active=online
     * @return boolean
     */
    public static boolean isOnline() {
        return ONLINE.equalsIgnoreCase(System.getProperty(PROFILES));
    }

    /**
     * isLocal spring.profiles.active=local
     * @return boolean
     */
    public static boolean isLocal() {
        return LOCAL.equalsIgnoreCase(System.getProperty(PROFILES));
    }

}
